package com.igoal.campaign.base;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.ui.ModelMap;

import com.igoal.dto.UserDTO;
import com.igoal.service.MailService;
import com.igoal.service.UserManagerExt;
import com.igoal.web.BaseControllerDelegate;

public abstract class BaseCampainController {
	protected final String REDIRECT_TO_HOMEPAGE = "redirect: /index.html";
	
	@Autowired
	MailService mailService;
	
	public MailService getMailService() {
		return mailService;
	}

	public void setMailService(MailService mailService) {
		this.mailService = mailService;
	}

	public UserManagerExt getUserManagerExt() {
		return userManagerExt;
	}

	public void setUserManagerExt(UserManagerExt userManagerExt) {
		this.userManagerExt = userManagerExt;
	}

	@Autowired
	UserManagerExt userManagerExt;
	
	@Autowired
	@Qualifier("controllerDelegate")
	BaseControllerDelegate delegate;
	
	public abstract String getViewPrefix();
	
	public boolean isLoginUser() {
		return delegate.isLoginUser();
	}
	
	public String getUserInSession(){
		return delegate.getUserInSession();
	}
	
	public UserDTO getUserInSessionInfo() {
		return delegate.getUserSession(userManagerExt);
	}

	public void applyModel(ModelMap modelMap, Object model){
		delegate.applyModel(modelMap, model);
	}
}
